//二维数组的定义与地址
#include<iostream>
using namespace std;
int main()
{
	/*
	int arr[2][3] = { {1,2,3},{4,5,6} };
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 3; j++) {
			cout << arr[i][j] << " ";
		}
		cout << endl;
	}
	*/
	/*int arr[][3] = { 1,2,3,4,5,6 };
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 3; j++) {
			cout << arr[i][j] << " ";
		}
		cout << endl;
	}*/
	int arr[2][3] = 
	{ 
		{1,2,3},
		{4,5,6} 
	};
	cout << "二维数组占用的内存的空间为： " << sizeof(arr) << endl;
	cout << "二维数组第一行占用空间： " << sizeof(arr[0]) << endl;
	cout << "二维数组第一个元素占用的内存: " << sizeof(arr[0][0]) << endl;
	cout << "二维数组的行数： " << sizeof(arr) / sizeof(arr[0]) << endl;
	cout << "二维数组的行数： " << sizeof(arr[0]) / sizeof(arr[0][0]) << endl;
	cout << endl;
	cout << "二维数组的首地址：" << (int)arr << endl;
	cout << "二维数组的第一行的首地址是：" << (int)arr[0] << endl;
	cout << "二维数组的第二行的首地址是：" << (int)arr[1] << endl;
	cout << endl;
	cout << "二维数组的第一个元素首地址： " << (int)&arr[0][0] << endl;
	cout << "二维数组的第二个元素首地址： " << (int)&arr[0][1] << endl;
	system("pause");
	return 0;
}